Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: given both retries and errors, prefer retries #376

Merged
merged 4 commits into from
Mar 20, 2015

Conversation

eapache
Copy link
Contributor

@eapache eapache commented Mar 20, 2015

Now that some errors (e.g. UnknownTopicOrParition) set both a retry flag and
an error, we should handle retries first. This is sort-of non-idiomatic in that
updateMetadata now returns a non-nil error with a "valid" result, but I think
that's OK.

@Shopify/kafka follow-up to #372

@wvanbergen
Copy link
Contributor

+1 this makes sense

Now that some errors (e.g. UnknownTopicOrParition) set *both* a retry flag and
an error, we should handle retries first. This is sort-of non-idiomatic in that
`updateMetadata` now returns a non-nil error with a "valid" result, but I think
that's OK.

metadataResponse3 := new(MetadataResponse)
metadataResponse3.AddTopic("new_topic", ErrUnknownTopicOrPartition)
seedBroker.Returns(metadataResponse3)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just re-use metadataResponse2 here, there's no need to construct a new one that's exactly the same

@eapache
Copy link
Contributor Author

eapache commented Mar 20, 2015

Good tests.

(It would be nice to also have tests that the retry behaviour is sane - somehow I missed writing any of those the first time around - but one thing at a time).

We permit it everywhere else we have backoffs. Use it to test the client's retry
strategy.
eapache added a commit that referenced this pull request Mar 20, 2015
client: given both retries and errors, prefer retries
@eapache eapache merged commit 6743438 into master Mar 20, 2015
@eapache eapache deleted the retry-over-error branch March 20, 2015 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants